function [R,C,sens]=celdas_skgmen1(wp,qp,g,wz,seteados)
   %RECIBE:
   %wp,qp,g,wz: valores de la funcion
   %setados: R1, R3 y R4
    R=ones(5,1);
    C=ones(2,1);
    
    R(1)=seteados(1);
    R(3)=seteados(2);
    R(4)=seteados(3);
    
    a=g/(1+(R(3))/(R(4)));
    R(5)=(R(1)*a)/(1-a);
    R(2)=R(1);
    r1=R(1)*a; 
    C(2)=(1/(qp*2*wp*r1)+sqrt((1/(qp*2*wp*r1))^2+4*R(3)/(2*R(4)*wp^2*r1^2)))/2;
    C(1)=1/(wp^2*r1^2*C(2));
    
    sens=ones(7,4);
    sens(:,1)=SenSallenLPGmen1W0(R(1),R(2),R(3),R(4),R(5),C(1),C(2));
    sens(:,2)=SenSallenLPGmen1Q(R(1),R(2),R(3),R(4),R(5),C(1),C(2));
    sens(:,3)=SenSallenLPGmen1G(R(1),R(2),R(3),R(4),R(5),C(1),C(2));
    sens(:,4)=[0,0,0,0,0,0,0];
end

function [senG]=SenSallenLPGmen1G(r1,r2,r3,r4,r5,c1,c2)
  senG(1)=-(r1*r4)/(r1*r4+r5*r4);                                                                                       %r1
  senG(2)=0;                                                                                                            %r2
  senG(3)=(r5*r3)/(r5*r4 + r5*r3);                                                                                      %r3
  senG(4)=(r4*(r5/(r1*r4 + r5*r4) - ((r1 + r5)*(r5*r4 + r5*r3))/(r1*r4 + r5*r4)^2)*(r1*r4 + r5*r4))/(r5*r4 + r5*r3);    %r4
  senG(5)=(r5*((r4 + r3)/(r1*r4 + r5*r4) - (r4*(r5*r4 + r5*r3))/(r1*r4 + r5*r4)^2)*(r1*r4 + r5*r4))/(r5*r4 + r5*r3);    %r5
  senG(6)=0;                                                                                                            %c1
  senG(7)=0;                                                                                                            %c2
end

function [senQ]=SenSallenLPGmen1Q(r1,r2,r3,r4,r5,c1,c2)

senQ(1) = r1*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*(((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5)^2 - (c2*r2 + c2*r5)/(r1 + r5) + (c1*r5*r3)/(r4*(r1 + r5)) - (c1*r1*r5*r3)/(r4*(r1 + r5)^2))/(((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))^2*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2)) - (1/(c1*c2*r1*r2*r5) - (r1 + r5)/(c1*c2*r1^2*r2*r5))/(2*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(3/2)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2);
senQ(2) =-r2*((c2*r1 + c2*r5)/((r1 + r5)*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))^2*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2)) - (r1 + r5)/(2*c1*c2*r1*r2^2*r5*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(3/2)))*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2);
senQ(3) =(c1*r1*r5*r3)/(r4*(r1 + r5)*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5))));
senQ(4) =-(c1*r1*r5*r3)/(r4*(r1 + r5)*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5))));
senQ(5) = r5*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*(((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5)^2 - (c2*r1 + c2*r2)/(r1 + r5) + (c1*r1*r3)/(r4*(r1 + r5)) - (c1*r1*r5*r3)/(r4*(r1 + r5)^2))/(((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))^2*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2)) - (1/(c1*c2*r1*r2*r5) - (r1 + r5)/(c1*c2*r1*r2*r5^2))/(2*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(3/2)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2);
senQ(6) = c1*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1*r5*r3)/(r4*(r1 + r5)*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))^2*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2)) + (r1 + r5)/(2*c1^2*c2*r1*r2*r5*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(3/2)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2);
senQ(7) =-c2*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1*r2 + r1*r5 + r2*r5)/((r1 + r5)*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))^2*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2)) - (r1 + r5)/(2*c1*c2^2*r1*r2*r5*((c2*r1*r2 + c2*r1*r5 + c2*r2*r5)/(r1 + r5) - (c1*r1*r5*r3)/(r4*(r1 + r5)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(3/2)))*((r1 + r5)/(c1*c2*r1*r2*r5))^(1/2);

end

function [senw0]=SenSallenLPGmen1W0(r1,r2,r3,r4,r5,c1,c2)

senw0(1) = (r1*(1/(c1*c2*r1*r2*r5) - (r1 + r5)/(c1*c2*r1^2*r2*r5)))/(2*((r1 + r5)/(c1*c2*r1*r2*r5)));
senw0(2) = -(r1 + r5)/(2*c1*c2*r1*r2*r5*((r1 + r5)/(c1*c2*r1*r2*r5)));
senw0(3) = 0;
senw0(4) = 0;
senw0(5) = (r5*(1/(c1*c2*r1*r2*r5) - (r1 + r5)/(c1*c2*r1*r2*r5^2)))/(2*((r1 + r5)/(c1*c2*r1*r2*r5)));
senw0(6) = -(r1 + r5)/(2*c1*c2*r1*r2*r5*((r1 + r5)/(c1*c2*r1*r2*r5)));
senw0(7) = -(r1 + r5)/(2*c1*c2*r1*r2*r5*((r1 + r5)/(c1*c2*r1*r2*r5)));

end